package com.bang.service.impl;

import com.bang.pojo.Permission;
import com.bang.mapper.PermissionMapper;
import com.bang.service.IPermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author: bangbang
 * @Date: 2019/11/14 19:16
 */
@Service
public class PermissionServiceImpl implements IPermissionService {

    @Autowired
    private PermissionMapper permissionMapper;

    @Override
    public List<String> queryPermissionByUserId(Integer userId) {

        List<Permission> list = permissionMapper.queryPermissionByUserId(userId);
        List<String> permissions = new ArrayList<>();
        for (Permission permission : list) {
            permissions.add(permission.getPercode());
        }
        return permissions;
    }
}
